home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / os2 / vsoup11.zip / kill.hh < prev    next >
Text File  |  1996-08-01  |  2KB  |  67 lines

  1. //  $Id: kill.hh 1.6 1996/08/01 12:11:21 hardy Exp $
  2. //
  3. //  This progam/module was written by Hardy Griech based on ideas and
  4. //  pieces of code from Chin Huang (cthuang@io.org).  Bug reports should
  5. //  be submitted to rgriech@ibm.net.
  6. //
  7. //  This file is part of soup++ for OS/2.  Soup++ including this file
  8. //  is freeware.  There is no warranty of any kind implied.  The terms
  9. //  of the GNU Gernal Public Licence are valid for this piece of software.
  10. //
  11.  
  12.  
  13. #ifndef __KILL_HH__
  14. #define __KILL_HH__
  15.  
  16.  
  17. #include <regexp.h>
  18. #include <stdio.h>
  19.  
  20. #include "mts.hh"
  21.  
  22.  
  23. class TKillFile {
  24. private:
  25.     //
  26.     // kill regular expression
  27.     //
  28.     typedef struct aExp {
  29.     struct aExp *next;    // next in list
  30.     regexp *re;        // compiled regular expression
  31.     } Exp;
  32.  
  33.     //
  34.     // kill file entry for a newsgroup
  35.     //
  36.     typedef struct aGroup {
  37.     struct aGroup *next;    // next in list
  38.     const char *name;    // newsgroup name
  39.     Exp *expList;        // list of kill expressions
  40.     } Group;
  41.  
  42.     Group *globalKill;        // global kill
  43.     Group *groupKillList;    // list of group specific kills
  44.     int   maxLines;             // max no of lines allowed for article
  45.     TSemaphor sema;
  46.     Group *cacheGroupKill;
  47.     const char *cacheGroupName;
  48.  
  49.     void killGroup( Group *gp );
  50.     Exp *readExp(const char *searchIn, const char *searchFor);
  51.     int matchExp(Group *pGroup, const char *buf);
  52.     Group *getGroupP( const char *groupName );
  53.  
  54. public:
  55.     TKillFile( void );
  56.     ~TKillFile();
  57.     TKillFile( const TKillFile &right );    // copy constructor not allowed !
  58.     operator = (const TKillFile &right);    // assignment operator not allowed !
  59.  
  60.     int readFile( const char *killFile, int maxLines = 0 );
  61.     int matchLine( const char *groupName, const char *line );
  62.     int doKillQ( const char *groupName );
  63. };
  64.     
  65.  
  66. #endif   // __KILL_HH__
  67.